@extends('admin.master')
<script src="/js/admin/index.js"></script>
@section('title', '绑定消息设置')
	
@section('firstItem')
@parent
				<span>绑定消息设置</span>
				<input class="a_indexbg" type="hidden" value="index" />
				
@stop
@section('searchList')
@parent
				<div class="seizeBox"></div>
@stop
@section('dataTables')
@parent
			<!-- html布局 -->
			<div class="setEditBox">
				@if(is_null($config))
				<div> 称 呼 语  ： <p placeholder="输入文本" ></p></div>
				<div>售后电话： <p placeholder="输入文本"></p></div>
				<div> 结束语  ： <p placeholder="输入文本"></p></div>
				@else
				<div> 称 呼 语  ：<p placeholder="输入文本" >{{ $config['content1'] }}</p></div>
				<div>售后电话：<p placeholder="输入文本">{{ $config['content2'] }}</p></div>
				<div> 结 束 语  ：<p placeholder="输入文本">{{ $config['content3'] }}</p></div>
				@endif
				<div class="buttonBox">
					<a class="buttonEdit">编辑</a>
					<a class="buttonY" style="display: none;">确定</a>
					<a class="buttonNo" style="display: none;">取消</a>
				</div>
			</div>

@stop
<script type="text/javascript">
	window.onload=function(){
		$(".bindInfor").css("backgroundColor","#224247").siblings().css("backgroundColor","#365d62").parent().siblings(".menuList").children().css("backgroundColor","#365d62");
		$(".moreSet").show();
		$(".imgMore").show().siblings().hide();
		//编辑按钮
		$(".buttonEdit").click(function(){
			$(".setEditBox p").attr("contenteditable","true").css("border","solid 1px #ccc");
			$(".setEditBox div:nth-child(1) p").focus();
			$(this).hide().siblings().show();
		});
		//取消按钮
		$(".buttonNo").click(function(){
			window.location="/admin/more/message/bind";
		});
		//确定按钮
		$(".buttonY").click(function(){
			$.ajax({
				url:"/admin/api/more/message/bind",
				type:"post",
				dataType:"json",
				data:{
					content1:$(".setEditBox div:nth-child(1) p").html(),
					content2:$(".setEditBox div:nth-child(2) p").html(),
					content3:$(".setEditBox div:nth-child(3) p").html()
				},
				success:function(data){
					if(data.status.errCode==0){	
						window.location="/admin/more/message/bind";	
					}else{
						hint(data.status.message);
					}
				}
			})
		});	
	}
</script>



